public class Clock {
    private Display hour;
    private Display minute;
    private Display second;


    public Clock(Display hour, Display minute,Display second) {
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }

    public Display getSecond() {
        return second;
    }

    public void setSecond(Display second) {
        this.second = second;
    }

    public Display getHour() {
        return hour;
    }

    public void setHour(Display hour) {
        this.hour = hour;
    }

    public Display getMinute() {
        return minute;
    }

    public void setMinute(Display minute) {
        this.minute = minute;
    }

    public void start(){
        while(true){
            second.increase();
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            if(second.getValue() == 0){
                minute.increase();
                try {
                    Thread.sleep(100);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
                if(minute.getValue() == 0){
                    hour.increase();
                    try {
                        Thread.sleep(100);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
            System.out.printf("%02d : %02d : %02d\n",hour.getValue(),minute.getValue(),second.getValue());
        }
    }
}
